
package net.eascn.babyClone.commands
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.rpc.IResponder;
	import mx.rpc.events.ResultEvent;
	
	import net.eascn.babyClone.business.*;
	import net.eascn.babyClone.model.ModelLocator;

	public class GetAlbumDefinedListCommand implements ICommand, IResponder
	{
		// attributes ============================
		private var model : ModelLocator = ModelLocator.getInstance();
		private var _GetAlbumDefinedListDelegate:GetAlbumDefinedListDelegate = new GetAlbumDefinedListDelegate(this as IResponder);



		// functions ============================
		public function execute( event:CairngormEvent ) : void
		{
			
			_GetAlbumDefinedListDelegate.getAlbumDefinedList();
			
		}
		
		//----------------------------------------------------------------------------
		public function result( data:Object ) : void
		{
			
			var list:XMLList  = (ResultEvent(data).result as XML).children();
			
			for (var i:int= 0 ; i < list.length() ; i++)
			{
				list[i] =XML(String (list[i].tpldata));
			}
			model.albumDefinedListXML.source = list.copy();
		}
		
		//----------------------------------------------------------------------------
		public function fault( info : Object ) : void
		{
			
			trace(info);
			
		}

	}
}